import mockAxios from "api/mockAxios";
import apiAxios from "api/apiAxios.js";

//暴露所有发送请求的函数

//mock接口  获取轮播图数据
export const getBanners = () => mockAxios.get("/banners")
//mock接口  获取楼层数据
export const getFloors = () => mockAxios.get("/floors")


//api接口 获取三级分类相关的数据
export const getBaseCategoryList = () => apiAxios.get("/product/getBaseCategoryList")
//api接口 获取商品列表
export const getGoods = (options) => apiAxios.post("/list",{...options})
//api接口 根据商品id获取商品详情
export const getDetailById = (skuId) => apiAxios.get(`/item/${skuId}`)
//api接口 添加购物车
export const addToCart = ({skuId,skuNum}) => apiAxios.post(`/cart/addToCart/${skuId}/${skuNum}`)
//api接口 获取购物车列表
export const getCartList = ()=> apiAxios.get(`/cart/cartList`)
//api接口 购物车中商品的选中操作
export const checkCart = ({skuId,isChecked})=> apiAxios.get(`/cart/checkCart/${skuId}/${isChecked}`)
//api接口 购物车中商品的删除操作
export const deleteCart = (skuId)=> apiAxios.delete(`/cart/deleteCart/${skuId}`)
//api接口 登录相关
export const getCode = (phone)=> apiAxios.get(`/user/passport/sendCode/${phone}`)
export const register = ({phone,password,code,nickName})=> apiAxios.post(`/user/passport/register`,{phone,password,code,nickName})
export const login = ({phone,password})=> apiAxios.post(`/user/passport/login`,{phone,password})
export const logout = ()=> apiAxios.get(`/user/passport/logout`)
export const autoLogin = ()=> apiAxios.get(`/user/passport/auth/getUserInfo`)
//api接口 支付相关
export const getTradeInfo = ()=> apiAxios.get(`/order/auth/trade`)
export const getUserAddress = ()=> apiAxios.get(`/user/userAddress/auth/findUserAddressList`)
export const submitOrder = (tradeNo,data)=> apiAxios.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,data)

//qrcode
export const getPayInfo = (orderId)=> apiAxios.get(`/payment/weixin/createNative/${orderId}`)
export const getPayStatus = (orderId)=> apiAxios.get(`/payment/weixin/queryPayStatus/${orderId}`)
export const getOrderList = (page=1,limit=5)=> apiAxios.get(`/order/auth/${page}/${limit}`)




